const student = require("./dataschema/student");
const scort = require("./dataschema/scort");


//populate(["关联的字段","关联的字段2"])
scort.find({score:{$gte:60}}).populate(["studentID"])
.then(
    (result)=>{
        result.map((item)=>{
            console.log(`姓名：${item.studentID.name}   分数：${item.score}`)
        })
    }
)


/*
scort.find({score:{$gte:60}})
.then(
    (scoreresult)=>{
        scoreresult.map((item)=>{
            student.findById(item.studentID)
            .then((studentresult)=>{
                console.log(`姓名：${studentresult.name}   分数：${item.score}`)
            })
        })
    }
)
*/